-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in FsaFromTensor for empty FSA; make index select from ragged… #481
Conversation
… print out error cause
When using this to debug the determinization failure in snowfall
|
I think we should be able to fix the determinization failure in snowfall by removing the disambiguation symbols before turning the ragged tensor of symbols into a linear one. |
I didn't print values before, but I have tried to remove disambiguation symbols back to that time before doing determinize, it still has the same issues. Anyway, let me try to print values with your lastest code. |
No, they need to be there for the determinization, that is the point, or
determinization won't terminate. [edit from dan: later realized this is not true of the aux_labels, the det symbols
are only needed on the phone side.]
Need to remove them after determinization but before trying to map the
aux_labels from ragged to linear.
…On Wed, Dec 9, 2020 at 3:29 PM Haowen Qiu ***@***.***> wrote:
I didn't print values before, but I have tried to remove disambiguation
symbols back to that time before doing determinize, it still has the same
issues. Anyway, let me try to print values with your lastest code.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#481 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZFLO7YSMNXWESBZHM4ZHLST4RPHANCNFSM4UTCGROA>
.
|
The call to determinize() can leave the aux_labels as ragged; the user can
convert them to linear after removing the disambig symbols.
…On Wed, Dec 9, 2020 at 3:32 PM Daniel Povey ***@***.***> wrote:
No, they need to be there for the determinization, that is the point, or
determinization won't terminate.
Need to remove them after determinization but before trying to map the
aux_labels from ragged to linear.
On Wed, Dec 9, 2020 at 3:29 PM Haowen Qiu ***@***.***>
wrote:
> I didn't print values before, but I have tried to remove disambiguation
> symbols back to that time before doing determinize, it still has the same
> issues. Anyway, let me try to print values with your lastest code.
>
> —
> You are receiving this because you modified the open/close state.
> Reply to this email directly, view it on GitHub
> <#481 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAZFLO7YSMNXWESBZHM4ZHLST4RPHANCNFSM4UTCGROA>
> .
>
|
Yeah, that's exactly what I did before (sorry for wrong expression above), I save aux_labels and labels before determinizing, and remove code |
|
I'd rather you call it arc_map rather than arc_derivs. |
And please show me output with sizes, so I can compare with my setup. |
what sizes do you need? num_states of determinized fsa? |
OK, I did some debugging and it doesn't appear to be a bug. I was just wrong to think that this type of situation would not occur. After thinking about various possible solutions, I think the best one is to 'cut the Gordian knot' and simply abandon the assumption that the aux_labels will be at most one per frame. That is: to leave it as a Ragged tensor. When doing further operations like epsilon removal, we need to use the appropriate method of indexing a ragged tensor with a ragged tensor, that will append the input lists. (I'll have to check whether the operation already exists, but it's basically indexing the old ragged tensor with the values of the index, using ComposeRaggedShapes to compose the shapes, removing axis 1, and using that as the shape of the output ragged object. I think we should probably create a RaggedTensor object, that holds a RaggedShape and a Tensor, for these kinds of purposes. |
Ah, OK. It sounds like BTW, do you think we should do something like |
indexing a ragged tensor with a ragged tensor
Ah, OK. It sounds like ComposeArcMaps? I was thought we need something
like index (aux) array with a ragged array (arc_map).
Yes, seems it's the same operation as ComposeArcMaps.
BTW, do you think we should do something like expand sequence of aux_labels
from Ragged to 1-D Array currently? as we do int host invertion.
Not sure what you are saying here, try to be more explicit.
… —
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#481 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZFLO6DEDNIO6TF5HDS2GLSUAPCFANCNFSM4UTCGROA>
.
|
I mean, for example, if one |
OK, so expanding the FSA to accommodate at most one label per arc. (There
are also "pushing" ways to do this).
The reason I'm not so hot on this is that our decoding methods do not
handle epsilons in the decoding graph.
…On Thu, Dec 10, 2020 at 11:37 AM Haowen Qiu ***@***.***> wrote:
I mean, for example, if one arc has two aux_labels, say [aux1, aux2],
then we expand the arc to two arcs, one arc is (arc.src_state,
temp_state, label=0, aux1, score=0), another arc is (temp_state,
arc.dest_state, arc.label, aux2, arc.score). We expand all arcs so that
we get a new Fsa with only one aux_label one arc.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#481 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZFLO4JKCMGDRKN6S7NQ3DSUA7AJANCNFSM4UTCGROA>
.
|
How about we make so the tensor_attr's can actually contain not just Tensor but also RaggedInt? I think that might be the path of least resistance. |
Agree, as BTW, for case that one arc has more than two aux_labels, we need to keep the order of arc-map values in each row of the k2/k2/csrc/host/determinize.cc Lines 193 to 196 in b59d4b1
Just mention this in case we forget it in the future, as for non-top-sorted version, the order may be non-ascending? |
Yes, the order is going to be kept.
…On Thu, Dec 10, 2020 at 2:24 PM Haowen Qiu ***@***.***> wrote:
Agree, as RaggedInt has the same Dim0 with all tensor_attr's in the
fsa(vec), i.e. the number of arcs.
BTW, for case that one arc has more than two aux_labels, we need to keep
the order of arc-map values in each row of the RaggedInt, seems we have
keep that in host version,
https://github.com/k2-fsa/k2/blob/b59d4b11ebfa8351fe75578475109ff3c86f10f7/k2/csrc/host/determinize.cc#L193-L196
Just mention this in case we forget it in the future, as for
non-top-sorted version, the order may be non-ascending?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#481 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZFLO32GAPRHJPAA2RM3MDSUBSS5ANCNFSM4UTCGROA>
.
|
… print out error cause